﻿//  --------------------------------
//  Copyright (c) PK Logix LLC. All rights reserved.
//  This source code is made available under the terms of the GNU General Public License version 2 (GPLv2)
//  http://www.codeplex.com/mvcclubsite/license
//  ---------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace MVCClubSite.Web
{
    public class MVCClubSiteSection : ConfigurationSection
    {
        public static MVCClubSiteSection Settings
        {
            get 
            { 
                return ConfigurationManager.GetSection("MVCClubSite") as MVCClubSiteSection; 
            }
        }

        [ConfigurationProperty("siteTitle")]
        public string SiteTitle
        {
            get { return base["siteTitle"].ToString(); }
            set { base["siteTitle"] = value; }
        }

        [ConfigurationProperty("siteSubTitle")]
        public string SiteSubTitle
        {
            get { return base["siteSubTitle"].ToString(); }
            set { base["siteSubTitle"] = value; }
        }

        [ConfigurationProperty("Announcements", IsRequired = true)]
        public AnnouncementsElement Announcements
        {
            get { return (AnnouncementsElement)base["Announcements"]; }
        }
    }

    public class AnnouncementsElement : ConfigurationElement
    {
        [ConfigurationProperty("pageSize", DefaultValue = "5")]
        public int PageSize
        {
            get { return int.Parse(base["pageSize"].ToString()); }
            set { base["pageSize"] = value; }
        }

        [ConfigurationProperty("recentCount", DefaultValue = "3")]
        public int RecentCount
        {
            get { return int.Parse(base["recentCount"].ToString()); }
            set { base["recentCount"] = value; }
        }
        
    }
}
